home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Special 16
/
AMIGAplus Sonderheft 16 (1998)(ICP)(DE)[!].iso
/
pd
/
anwendungen
/
xpk_source
/
shell
/
xquery.c
< prev
next >
Wrap
C/C++ Source or Header
|
1998-08-27
|
3KB
|
107 lines
#define NAME "xQuery"
#define DISTRIBUTION "(Freeware) "
#define REVISION "4"
/* Programmheader
Name: xQuery
Author: SDI (before 1.2 Urban Dominik Müller)
Distribution: Freeware
Description: Query packer properties
Compileropts: -
Linkeropts: -l xpkmaster
1.0 : first public release
1.1 : version string added, docs added
1.2 : changes by SDI
1.3 29.11.96 : fixed for new includes and Maxon C++
1.4 12.05.97 : allways showed default mode 0 - fixed
*/
#include "SDI_defines.h"
#define SDI_TO_ANSI
#include "SDI_ASM_STD_protos.h"
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/xpkmaster.h>
#ifdef __MAXON__
#define __asm
#endif
struct Library *XpkBase = 0;
UBYTE errbuf[XPKERRMSGSIZE];
UBYTE line1[200], line2[200], line3[200], line4[200];
UBYTE line5[200], line6[200], line7[200];
void end(const STRPTR text)
{
if(text) printf(text);
if(XpkBase) CloseLibrary (XpkBase);
exit(text ? 10 : 0);
}
void packerquery(STRPTR packer)
{
struct XpkPackerInfo xpinfo;
struct XpkMode xminfo;
LONG mode, res;
UBYTE name[5];
printf("\23332mPacker :\233m %s\n", packer);
if(res = XpkQueryTags(XPK_PackerQuery, &xpinfo,
XPK_PackMethod, packer,
TAG_DONE))
return;
printf("\23332mName :\233m %s\n", xpinfo.xpi_LongName);
printf("\23332mDescr. :\233m %s\n", xpinfo.xpi_Description);
printf("\23332mDefMode:\233m %ld\t", xpinfo.xpi_DefMode);
printf("\23332mDefChunk:\233m %ld Kb\t", xpinfo.xpi_DefChunk >> 10);
printf("\23332mMaxChunk:\233m %ld Kb\n", xpinfo.xpi_MaxChunk >> 10);
printf(" Pack Unpack Pack Unpack\n");
printf("Name Mode Ratio Speed Speed Mem Mem Description\n");
/* FAST 99..100 99.7% 1024K/s 1040K/s 1024K 1024K Gnubbeldubbel */
CopyMem(packer, name, 4); name[4] = 0;
for(mode = 0; mode < 100 && !CTRL_C; mode = xminfo.xm_Upto + 1)
{
if(XpkQueryTags(XPK_ModeQuery, &xminfo,
XPK_PackMethod, packer,
XPK_PackMode, mode,
TAG_DONE))
break;
printf("%4.4s %2ld..%-3ld %2ld.%1ld%% %4ldK/s %4ldK/s %4ldK %4ldK %s\n",
name, mode, xminfo.xm_Upto, xminfo.xm_Ratio / 10, xminfo.xm_Ratio % 10,
xminfo.xm_PackSpeed, xminfo.xm_UnpackSpeed,
xminfo.xm_PackMemory >> 10, xminfo.xm_UnpackMemory >> 10,
xminfo.xm_Description);
}
printf("\n");
}
void main(int argc, char **argv)
{
struct XpkPackerList list;
LONG i;
if(!(XpkBase = OpenLibrary(XPKNAME, 0)))
end("Cannot open " XPKNAME "\n");
if(XpkQueryTags(XPK_PackersQuery, &list, TAG_DONE))
end("Cannot get information");
if(argc == 1)
for(i = 0; i < list.xpl_NumPackers && !CTRL_C; i++)
packerquery(list.xpl_Packer[i]);
else
for(i = 1; i < argc; i++)
packerquery(argv[i]);
end(CTRL_C ? "***Break\n" : NULL);
}